import { createApp } from 'vue';

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/assets/iconfont/iconfont.css';
import '@/assets/iconfont/iconfont.js';
import App from './App.vue';
import './assets/global.less';
import components from './components/global';
import Router from './router/index';
import {setupStore} from './store/index';

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 一次性解决时区和日期格式问题
import moment from 'moment'

//element 国际化 中文支持
import zhCn from 'element-plus/es/locale/lang/zh-cn'

Date.prototype.toISOString = function(){
    return moment(this).format('YYYY-MM-DD HH:mm:ss')
}


const app = createApp(App)
/**
 * productionTip
 */
app.config.productionTip = false

setupStore(app); // 挂载Pinia
// components
for (const i in components) {
  app.component(i, components[i])
}


for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}


app.use(ElementPlus,{
  locale: zhCn,
})
app.use(Router).mount('#app')

app.use(ElementPlus, { size: 'small', zIndex: 3000 })
